package com.source.adnroid.comm.ui.activity;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.source.adnroid.comm.ui.fragment.ChatFragment;
import com.source.android.androidcomm.R;

public class ChatActivity extends AppCompatActivity {
    private ChatFragment chatBaseFragment;
    private FragmentManager manager;
    private FragmentTransaction transaction;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat);
        initChatFragment();
    }

    /**
     * 拿到事务管理器并开启事务
     */
    private void initChatFragment(){
        chatBaseFragment =new ChatFragment();
        manager = getSupportFragmentManager();
        transaction = manager.beginTransaction();
        transaction.replace(R.id.chat_content, chatBaseFragment);
        transaction.commit();
    }
}
